package com.ity.teamanagement.mapper;

import com.ity.teamanagement.entity.Article;
import com.ity.teamanagement.entity.inputParam.ArticleSelectParam;
import com.ity.teamanagement.entity.inputParam.BackSearchTeaParam;
import com.ity.teamanagement.entity.outputResult.ArticleDetailsVo;
import com.ity.teamanagement.entity.outputResult.ArticleListVo;
import com.ity.teamanagement.entity.outputResult.BackTeaListMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author coderFu
 * @create 2021/11/10
 */
@Mapper
public interface ArticleMapper {

    /**
     * 后台添加文章
     * @param article
     * @return
     */
    Integer addArticle(Article article);

    /**
     * 后台根据文章id删除文章
     * @param id
     * @return
     */
    Integer deleteArticle(Integer id);

    /**
     * 后台根据文章id修改文章内容
     * @param article
     * @return
     */
    Integer updateArticle(Article article);

    /**
     * 根据文章类别查询文章列表数据
     * @param type
     * @return
     */
    List<ArticleListVo> getArticleByType(Integer type);

    /**
     * 根据文章类别查询文章信息，无条件时，默认全部查询倒序排列
     * @param articleSelectParam
     * @param pageNumber
     * @param pageSize
     * @return
     */
    List<ArticleListVo> getArticleByTypeForPages(ArticleSelectParam articleSelectParam, int pageNumber, int pageSize);

    /**
     * 根据文章类别查询所有文章数目
     * @param articleSelectParam
     * @return
     */
    int getArticleByTypeForTotal(@Param("articleSelectParam") ArticleSelectParam articleSelectParam);

    /**
     * 根据文章id查询文章详情信息
     * @param id
     * @return
     */
    ArticleDetailsVo getArticleDetailsById(Integer id);

    /**
     * 根据文章id更新文章阅读数目
     * @param id
     */
    void updateArticleReadCount(Integer id);
}
